<template>
  <div>
    <file-upload :fileSize="fileSize" :fileType="fileType" ></file-upload>
  </div>
</template>
<script>
import { uploadFile } from "@/api/tool/common"
import FileUpload from "@/components/FileUpload"
export default {
  components: {
    FileUpload
  },
  props: [],
  data() {
    return {
      formData: {
        files: null,
      },
      fileType: ['png', 'jpg', 'jpeg',"doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt", "pdf"],
      fileSize: 100,
      rules: {},
      fileAction: process.env.VUE_APP_BASE_API + '/common/upload',
      filefileList: [],
    }
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    // 上传文件
    uploadFile() {
      let formData = new FormData()
      formData.append("file", data, this.options.filename)
      uploadFile(formData).then(response => {
        this.open = false
        this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl
        store.commit('SET_AVATAR', this.options.img)
        this.$modal.msgSuccess("修改成功")
        this.visible = false
      })
    },
    fileBeforeUpload(file) {
      let isRightSize = file.size / 1024 / 1024 < 100
      if (!isRightSize) {
        this.$message.error('文件大小超过 100MB')
      }
      return isRightSize
    },
  }
}

</script>
<style>
.el-upload__tip {
  line-height: 1.2;
}

</style>
